<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:mtg="http://www.patelski.myself/jsf"
	xmlns:a="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">

	<ui:define name="body">

		<rich:modalPanel id="addCardPopup" resizeable="false" width="500">
			<h:panelGrid id="addCardPopupGrid" columns="1" width="100%">
				<h:panelGrid columns="1" width="100%">
					<a:outputPanel id="addToInventory">
						<a:form id="addToInventoryForm">
							<h:panelGrid columns="2" width="100%">

								<h:outputText value="Card: " />
								<h:outputText id="cardName"
									value="#{inventoryHome.card.cardName}" />
								<h:outputText value="Number of copies: " />
								<h:inputText id="add" value="#{inventoryHome.instance.have}" />
								<h:outputText value="Keep: " />
								<h:inputText id="keep" value="#{inventoryHome.instance.keep}" />
								<h:outputText value="Sell each for: " />
								<h:inputText id="sellAmount"
									value="#{inventoryHome.instance.sellAmount}" />
								<h:outputText value="Bought these for: " />
								<h:inputText id="spent"
									value="#{inventoryHome.instance.totalAmount}" />
								<h:outputText value="Note: " />
								<h:inputText id="note" value="#{inventoryHome.instance.note}" />
								<h:inputHidden id="addCardId" value="#{inventoryHome.addCardId}" />
								<a:commandButton id="addToInventoryButton" value="Add Card"
									action="#{inventoryHome.addCard()}" reRender="messages"
									onclick="Richfaces.hideModalPanel('addCardPopup')" />
							</h:panelGrid>
						</a:form>
					</a:outputPanel>
				</h:panelGrid>
				<h:commandButton value="Close"
					onclick="Richfaces.hideModalPanel('addCardPopup')" />
			</h:panelGrid>
		</rich:modalPanel>




		<rich:tabPanel style=" width : 100%; " switchType="client">
			<rich:tab id="editionData" style=" width: 100%; "
				label="Edition data" styleClass="tab">
				<h:panelGrid columns="1" style=" width : 100%; " cellpadding="2px"
					cellspacing="2px">
					<h:panelGrid columns="1" style=" width : 100%; " cellpadding="0px"
						cellspacing="0px">


						<rich:panel style="width : 100%; ">
							<f:facet name="header">
								<h:outputText value="#{editionHome.instance.name}"
									styleClass="header" />
							</f:facet>
							<h:panelGrid columns="2" style=" width : 100%; "
								columnClasses="fifty, fifty" cellpadding="0px" cellspacing="0px">

								<s:decorate id="headerName" template="layout/display.xhtml">
									<ui:define name="label">Name</ui:define>
					            	#{editionHome.instance.name}
								</s:decorate>
								<div style="clear: both" />
							</h:panelGrid>
						</rich:panel>

						<rich:panel>
							<f:facet name="header">
								<h:outputText value="#{editionHome.instance.name}"
									styleClass="header" />
							</f:facet>
							<rich:panel>
								<mtg:photo src="#{editionHome.instance.expansionSymbol}"
									width="45" />
							</rich:panel>
						</rich:panel>
					</h:panelGrid>


					<br />
					<br />


					<rich:panel style=" width : 100%;">
						<f:facet name="header">
							<h:outputText value="Edition info" styleClass="header" />
						</f:facet>
						<h:panelGrid columns="2" style=" width : 100%; "
							columnClasses="fifty, fifty">

							<s:decorate id="name" template="layout/display.xhtml">
								<ui:define name="label">Name</ui:define>
					            #{editionHome.instance.name}
							</s:decorate>
							<s:decorate id="printSize" template="layout/display.xhtml">
								<ui:define name="label">Print-size</ui:define>
            					#{editionHome.instance.printSize}
       						</s:decorate>
							<s:decorate id="blockName" template="layout/display.xhtml">
								<ui:define name="label">Block</ui:define>
            					#{editionHome.instance.blockName}
       						</s:decorate>
							<s:decorate id="editionCategorie" template="layout/display.xhtml">
								<ui:define name="label">Categorie</ui:define>
            					#{editionHome.instance.editionCategorie.name}
       						</s:decorate>
							<s:decorate id="releaseDate" template="layout/display.xhtml">
								<ui:define name="label">Release-date</ui:define>
								<h:outputText value="#{editionHome.instance.releaseDate}">
									<s:convertDateTime type="both" pattern="dd-MM-yyyy" />
								</h:outputText>
							</s:decorate>
						</h:panelGrid>
						<h:panelGrid columns="1" style=" width : 100%; ">
							<s:decorate id="description" template="layout/display.xhtml">
								<ui:define name="label">Description</ui:define>
					            #{editionHome.instance.description}
							</s:decorate>
						</h:panelGrid>
					</rich:panel>
					<br />
					<br />

					<div class="actionButtons"><s:button
						view="/EditionEdit.xhtml" id="edit" value="Edit" /> <s:button
						view="/#{empty editionFrom ? 'EditionList' : editionFrom}.xhtml"
						id="done" value="Done" /></div>
					<br />
					<br />
					<rich:panel style="width:100%;">
						<f:facet name="header">
							<h:outputText value="Cards in this set" styleClass="header" />
						</f:facet>


						<!-- rich:dataTable value="#{editionHome.theSet}" var="card"
							rendered="#{not empty editionHome.theSet}" id="cardsTable"
							cellpadding="0px" cellspacing="0px" style="width:90%;">
							<mtg:cardRow card="#{card}" />
						</rich:dataTable -->


			<rich:dataGrid value="#{editionHome.theSet}" var="card"
				rendered="#{not empty editionHome.theSet}" id="cardsTable"
				cellpadding="0px" cellspacing="0px" columns="5" elements="80"
				style="width:90%;">

				<mtg:cardQuickPanel card="#{card}" />

				<h:form>
					<f:facet name="footer">
						<rich:datascroller></rich:datascroller>
					</f:facet>
				</h:form>
			</rich:dataGrid>




					</rich:panel>
				</h:panelGrid>
			</rich:tab>
		</rich:tabPanel>

	</ui:define>

</ui:composition>
